UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Br8OqnKdbDYbtWN8+62uMVjGxofELUOlzhCRnNODbgw=' 
WHERE 
  key_id = '46a52a130fd87865200be0d607b8113aebaf4fb659e54492b8b8277bd7a8e55b' 
  AND (
    token = 'Br8OqnKdbDYbtWN8+62uMVjGxofELUOlzhCRnNODbgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028