UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWRSD7Gu8rL73qjWrTDBdqAoxJInwnwXJf9qLg+KN/s=' 
WHERE 
  key_id = 'c69321e1b172376bd142db1bc4057c67b628ea311e385cbcb49a903afd698ade' 
  AND (
    token = 'qWRSD7Gu8rL73qjWrTDBdqAoxJInwnwXJf9qLg+KN/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036