UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'strsdkW3rIEw8LJggvwn87iGROllvAf2TSLoERLVfpM=' 
WHERE 
  key_id = '10e3e2050e6ac4e60d7d27519239f8fcf98fa32b6929d6ba0b4815f63c0107f4' 
  AND (
    token = 'strsdkW3rIEw8LJggvwn87iGROllvAf2TSLoERLVfpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026