UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4YekiGW46532HH8n+CmyKHlE1xW+G/EU0de41pMzr4=' 
WHERE 
  key_id = '225e3c14daa8f064d79fd2eb080a9404a5b2201ceb2aba16ada73eb2d49b71b8' 
  AND (
    token = 'y4YekiGW46532HH8n+CmyKHlE1xW+G/EU0de41pMzr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018