UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KARNi+03870S2PWI/d3f8mRIOevEgn/lnrYeSgaaG+c=' 
WHERE 
  key_id = '91372358032775e6156520c93ff5b4af3503644925da66de14c80b7abd43ac28' 
  AND (
    token = 'KARNi+03870S2PWI/d3f8mRIOevEgn/lnrYeSgaaG+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034