UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3CbZCkAl3s5Rg4+k7bixqGHPQpGdVjY7LobZYVgnWs=' 
WHERE 
  key_id = '1a33579699f82f807aead5b4b6d5508b512812f400bb375d414b5296e89f964f' 
  AND (
    token = 'e3CbZCkAl3s5Rg4+k7bixqGHPQpGdVjY7LobZYVgnWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032