UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i59fiZudv30vviA9krJ8R6ZkOdgmNX2o2jjh3w0hQ3o=' 
WHERE 
  key_id = '48610a37f6a2e5bb475c5e034815e75c206706cbe8b55a50c96edc7a64e7d9b4' 
  AND (
    token = 'i59fiZudv30vviA9krJ8R6ZkOdgmNX2o2jjh3w0hQ3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050