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