UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'okbErRRH7+nd28iqjx679a5mB+kuY6RubuB2DZrOm9w=' 
WHERE 
  key_id = 'c3f98ee6413379352d449f61ea83d9e724b3f91b5a9aa79a887c696bc88d198b' 
  AND (
    token = 'okbErRRH7+nd28iqjx679a5mB+kuY6RubuB2DZrOm9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055