UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AFesYH5ngovYOB9ElK2IbcTCxLvjBIN8lm+CMDQz+SI=' 
WHERE 
  key_id = '9b315fc445fa650dfa0e46cd7519bd8b7f7985d6e1270b093454774fccea8adf' 
  AND (
    token = 'AFesYH5ngovYOB9ElK2IbcTCxLvjBIN8lm+CMDQz+SI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022