UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x662jySM7xnWUVNWE14KrjJQB2HMeDm4ffYsQKScyDM=' 
WHERE 
  key_id = '89134df793f87d24d8628a5fc80817ef8f93519848158a1e3aa83d983708089d' 
  AND (
    token = 'x662jySM7xnWUVNWE14KrjJQB2HMeDm4ffYsQKScyDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039