UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+PMxHZx+/UHeLCN8wRtJRr/ukyOup82/eGUHFgSosIs=' 
WHERE 
  key_id = 'de0f90c048515507e14af82c0c6f12505533aa5a38b5fa649cca83dc2c793f29' 
  AND (
    token = '+PMxHZx+/UHeLCN8wRtJRr/ukyOup82/eGUHFgSosIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038