UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3dpgFtIuIns4vMzcp4HuAq0QJGlwlcOUK2ZGVqKJ63A='
WHERE
key_id = 'bd5df8102aa0bcf1c943a0d7f1780e461384dd1497686c9cc785e50e7ee2557b'
AND (
token = '3dpgFtIuIns4vMzcp4HuAq0QJGlwlcOUK2ZGVqKJ63A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)