UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8c2A02aFe9+lK+gg6VZ9+EX0Kwpc0rrIvRCjFF+6wxo=' 
WHERE 
  key_id = '4c9937b29064898cfb54e1b50d3a56a8cc1bc675dc74835eac41956470aec489' 
  AND (
    token = '8c2A02aFe9+lK+gg6VZ9+EX0Kwpc0rrIvRCjFF+6wxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041