UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DkriyxYZy7nP5GiSMbZw6bpisLZpKp+5ask9Ploj2bM=' 
WHERE 
  key_id = '95a4a4dd670c1aeef3c8b5acfe8b49223525e6f79871d965629be37669752a20' 
  AND (
    token = 'DkriyxYZy7nP5GiSMbZw6bpisLZpKp+5ask9Ploj2bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050