UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HtS0h1vN5yA9KKhfkkZMM9g6moAOipi040O7F+Z84k8=' 
WHERE 
  key_id = 'ac6ff9eb5b9f773bdcee48c48b1ad7edf04c1b175359b6b8ac5c775dc9ac6c66' 
  AND (
    token = 'HtS0h1vN5yA9KKhfkkZMM9g6moAOipi040O7F+Z84k8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026