UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q7yhq7g3SOCPAmFasiX05uTzcOvLxHwVqegW0UkZkMo=' 
WHERE 
  key_id = 'd35883e9031aa8deab9cb203dd9599407b322e49486d316769af022fb8ba1369' 
  AND (
    token = 'Q7yhq7g3SOCPAmFasiX05uTzcOvLxHwVqegW0UkZkMo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041