UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mXHtXulWpO2VK0DOpHJmoZcdINyzo6+FPfYKpt1DUsY='
WHERE
key_id = 'd4812608f116151b6a0e59bbaac8d89e4b3034acf90fe062b445a178d756471d'
AND (
token = 'mXHtXulWpO2VK0DOpHJmoZcdINyzo6+FPfYKpt1DUsY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)