UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OPmwVJ6u6/5BVtiEw/4kl9BUbpYlx2nb8INpTCUBW5s=' 
WHERE 
  key_id = '8168553df5d3b8000f7a84b62e4caf456daa862c25a1ce4ce7da6905d31f7079' 
  AND (
    token = 'OPmwVJ6u6/5BVtiEw/4kl9BUbpYlx2nb8INpTCUBW5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029