UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'li9uhKrxQcwzTD1EtCuBWaiPJHy2+/PCs1MJiPf1Xik=' 
WHERE 
  key_id = 'b6f970f67b0e5ad893d9bca1968cb2bdf1cce388108e73d04e80de5eea0a7e05' 
  AND (
    token = 'li9uhKrxQcwzTD1EtCuBWaiPJHy2+/PCs1MJiPf1Xik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034