UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1065vCnHFxhdi1RIiyByY4yszg0vyeTcquVkmKHAKbc=' 
WHERE 
  key_id = 'd349a10f66a8731278aa8e26e1f27b05c57dfcc3b7f302a945482a20398b09b1' 
  AND (
    token = '1065vCnHFxhdi1RIiyByY4yszg0vyeTcquVkmKHAKbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022