UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vIDU8MJdUpgXT6sywRcZIf0RkEhrHB30fl2uzVvUG58=' 
WHERE 
  key_id = '8118a924284d0aead4baff5385df86f2e2872996d86b9ea6dbdad2958f782e9e' 
  AND (
    token = 'vIDU8MJdUpgXT6sywRcZIf0RkEhrHB30fl2uzVvUG58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027