UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MguS9BXQKTQvmu8Kzu1RI00+4biVuWcg748XFYT9CuQ=' 
WHERE 
  key_id = '1fc2df6eef065b5390a24e5db036981673c32c60e4626bbb500a075955f90da4' 
  AND (
    token = 'MguS9BXQKTQvmu8Kzu1RI00+4biVuWcg748XFYT9CuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028