UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c9qLQs1rPjEUGzwli70g0EgQJMkkxcTOV0sis7RX67M=' 
WHERE 
  key_id = '724d40f12a6891de6f75f2d30bb546c96c5074767d847863a0bd6f9978e65bd4' 
  AND (
    token = 'c9qLQs1rPjEUGzwli70g0EgQJMkkxcTOV0sis7RX67M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029