UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RGhJ/EQPE4NoiHIWiEqOGooQNZh5AH+LqFi3ntY2gjo=' 
WHERE 
  key_id = 'c81442a9ab9f7f690b835e6d24606a4dc2af222756da3b79057ca99149fb4fe9' 
  AND (
    token = 'RGhJ/EQPE4NoiHIWiEqOGooQNZh5AH+LqFi3ntY2gjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051