UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oKwUVkCp/BoHYeGBrDYZA7aKgJ/RWWy25Oe1tTSPcwg=' 
WHERE 
  key_id = 'f329169bf514d8baf115494950ebbdec8209efbe8e1f92e7cce87e42df5c6838' 
  AND (
    token = 'oKwUVkCp/BoHYeGBrDYZA7aKgJ/RWWy25Oe1tTSPcwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039