UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hi7i2GorE5dqaLINW9OQS1XcKhMkKcIIZwHxuhaLFqw='
WHERE
key_id = '50dc168acb94a4df6793e20b6874ea1c5b1aa5d2163311f3b957688aa777a526'
AND (
token = 'Hi7i2GorE5dqaLINW9OQS1XcKhMkKcIIZwHxuhaLFqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)