UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BJf/wYa+KCMNUiTmi/Ud7cDdFYc6yzMp6h3HzEWlOf0='
WHERE
key_id = '4c606be8165b4d339a0f8e7c94ef59723c9bdfaabed3e967b2c017f3cb3395f1'
AND (
token = 'BJf/wYa+KCMNUiTmi/Ud7cDdFYc6yzMp6h3HzEWlOf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)