UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PzS5FIqAWvf/KL3efydoXZeu0+QdrdbE548D5PWezo4='
WHERE
key_id = '4eca27bf0d630c610831d80dd53a4dbdd86e92395a71656b8a5d813d8d856bda'
AND (
token = 'PzS5FIqAWvf/KL3efydoXZeu0+QdrdbE548D5PWezo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)