UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'COL64M84cZNvK6SSHqbuu2CViPKu+alNz6IXkCjPsNU=' 
WHERE 
  key_id = '4cb032ee2a32ea0d5bcd54287a3e4da164670048de164798b858e457fd2a199d' 
  AND (
    token = 'COL64M84cZNvK6SSHqbuu2CViPKu+alNz6IXkCjPsNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032