UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l9hmvc9cA6Ns4qPxI6ffK8KZDkLgCuPFF5OEOdikTcQ='
WHERE
key_id = '57cf0d8f4c58d7bb8b2c44172f3c5750b1e5decbaa94927d7e47daa5340e08c9'
AND (
token = 'l9hmvc9cA6Ns4qPxI6ffK8KZDkLgCuPFF5OEOdikTcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)