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

Query time 0.00044