UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QBxCCSbBX5S6GCuVDlUXs0qy4VezGWEWGjxDMviBanE=' 
WHERE 
  key_id = '035af2cbe38a034a02cc028f90192856c217f33858cb4533ecd25e65d9bcd646' 
  AND (
    token = 'QBxCCSbBX5S6GCuVDlUXs0qy4VezGWEWGjxDMviBanE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038