UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iLc0mxsxHHDCVWh4Yh7brbWAk/jEfgjddQ3QeeAaDMo=' 
WHERE 
  key_id = '0a46d2c9b41efce5c1029cf73b8123b10112935adbc124c53cf292524e59d758' 
  AND (
    token = 'iLc0mxsxHHDCVWh4Yh7brbWAk/jEfgjddQ3QeeAaDMo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025