UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2rwBtqo/g4kpzRGovZgFkAmIQ/qPYlHlI3z8L3Ssrqo=' 
WHERE 
  key_id = '9e4d84024ef64e539af09148785f02444b16437bf8582b8516e06107e81f0aad' 
  AND (
    token = '2rwBtqo/g4kpzRGovZgFkAmIQ/qPYlHlI3z8L3Ssrqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038