UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's6pFpmmQHaLDNmHnkTO0sWSWuty3ZrmLuWaaCkjdemc=' 
WHERE 
  key_id = '8bf7e257aaf410e9c415aca08e8f94d0cdc176321f77dab56a345f2df9288a9a' 
  AND (
    token = 's6pFpmmQHaLDNmHnkTO0sWSWuty3ZrmLuWaaCkjdemc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029