UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/9Uj/PGTccSw45t2p2j7bAOgZauoO+CzimJ/cu0UdX4=' 
WHERE 
  key_id = '6bec1964915aad7eb8d98b4c01fa984b017ece5c19ff90a0333729cf95801bea' 
  AND (
    token = '/9Uj/PGTccSw45t2p2j7bAOgZauoO+CzimJ/cu0UdX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032