UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7w1ghM+Hi+F1lxAWbSVWk88b5lYncj5GvqATPthNNKI=' 
WHERE 
  key_id = 'd3e2e6ed8445ee1aa4cf406585a321d364ac8f6b237b741e772675960fa66699' 
  AND (
    token = '7w1ghM+Hi+F1lxAWbSVWk88b5lYncj5GvqATPthNNKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039