UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sgnYYXpm5EB7+/8JMIuYmex9Yj+uZTxjp7XDnEXKvYo=' 
WHERE 
  key_id = '8af369d513c4dc7ca71d94943070832dc8ae8fc35eb4d6412d37e24b2073eeba' 
  AND (
    token = 'sgnYYXpm5EB7+/8JMIuYmex9Yj+uZTxjp7XDnEXKvYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028