UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cnz23HTj4MGE6gdjnZlm/c9LElvv+bomNSm51Er0fCs=' 
WHERE 
  key_id = '6bdb4fb33750092619d10479a24589b10560bf428e6163a9178d394f0a9353fd' 
  AND (
    token = 'Cnz23HTj4MGE6gdjnZlm/c9LElvv+bomNSm51Er0fCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036