UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'laM5WAaZ8CZhZV8bxsf5V2l2GGkO+5pw6mmFDTXQqhY=' 
WHERE 
  key_id = '8253eef7dc3d8a33798e60fe079838afc96526808aef822bd4021b117bd29e2e' 
  AND (
    token = 'laM5WAaZ8CZhZV8bxsf5V2l2GGkO+5pw6mmFDTXQqhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040