UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wrdXqXjVd6tUyAJsvqQCHyf57Qfh1P81f4HYu62k3Ks='
WHERE
key_id = 'e09d56988d590d02dd4650a90c9c737088107b1bd7878f6fb968fe7b773cb923'
AND (
token = 'wrdXqXjVd6tUyAJsvqQCHyf57Qfh1P81f4HYu62k3Ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)