UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lncXLH8+c3SPi3fyeAViPFBNuU/ZFg7NA6qokipZxJ4=' 
WHERE 
  key_id = '78c8d4979c619a8b5fd15eca4cc797fb445b2ca1260b6161fe24402530445399' 
  AND (
    token = 'lncXLH8+c3SPi3fyeAViPFBNuU/ZFg7NA6qokipZxJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031