UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oWbtBUs9YzJAhB9yFPeIlFhapwRqM8rggzcVTrxAMpM=' 
WHERE 
  key_id = '4107ea400e4c8ef1968043c6aece9f834008727d669cddf732062a29e3e21a64' 
  AND (
    token = 'oWbtBUs9YzJAhB9yFPeIlFhapwRqM8rggzcVTrxAMpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021