UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+UOF288pFJfc6ejx+LGjg1Csw30U4OLxqWvSReEoaE=' 
WHERE 
  key_id = '1fbf137175b811f9ea47a3608efbd5b4f96aada058fcfaaa0ea7f39439714635' 
  AND (
    token = 'X+UOF288pFJfc6ejx+LGjg1Csw30U4OLxqWvSReEoaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021