UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oPIdt12ei8jT4Yg74tjPeBMvk/u9hpbsfvclNhgxle4='
WHERE
key_id = '964fbe5912c791fabce3604d0bba92ce2a2f1d34f890464fc827ecd1707c1baf'
AND (
token = 'oPIdt12ei8jT4Yg74tjPeBMvk/u9hpbsfvclNhgxle4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)