UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i7mcIxpOUlPRbzFSSq00WAsV2x89ZQyWzdOoJ84cQRY=' 
WHERE 
  key_id = 'fb6aa111c18168f9f2f531409030f0ab56b667e0568c4ab0a5e5dd2f36682533' 
  AND (
    token = 'i7mcIxpOUlPRbzFSSq00WAsV2x89ZQyWzdOoJ84cQRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021