UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vOBa9CYJhH/mV28rnStd6SMq5pY4xktftMyQ52PbxQc=' 
WHERE 
  key_id = '4faea70e96744970d30c898151cc5a390716781b11108c337a361935a15e6d71' 
  AND (
    token = 'vOBa9CYJhH/mV28rnStd6SMq5pY4xktftMyQ52PbxQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023