UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wSO5FSa9qMTzQ3Ugf7cm27keHWihgRI+G4U12effBGo=' 
WHERE 
  key_id = 'd9ad139627327c47a08f290cbc2c12a954f8211712482998dcf1dc05236ebae0' 
  AND (
    token = 'wSO5FSa9qMTzQ3Ugf7cm27keHWihgRI+G4U12effBGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045