UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x/eLc61IOuZS0TYG81WDMwCpDLem8sP7/qmnkzuyDa4=' 
WHERE 
  key_id = '6e9fc61d4e1e9fea6f9a99837aefe6fd5809e03beca1ff8dc48f80f9d48bf55e' 
  AND (
    token = 'x/eLc61IOuZS0TYG81WDMwCpDLem8sP7/qmnkzuyDa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032