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

Query time 0.00045