UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RH2wXetCEBsVPy2jlH6yGiD53+Ph/M4NidZniPFn0r8=' 
WHERE 
  key_id = '795bfcd7551565dfbc721c6d214be57a40111c007692f8d64d1961f60377d168' 
  AND (
    token = 'RH2wXetCEBsVPy2jlH6yGiD53+Ph/M4NidZniPFn0r8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074