UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PKOoXyfMVX8XViYMAdrvEnmGDk+/ABoJBSnF2/MZhms='
WHERE
key_id = '77ef2ba3c0cbe2584c73c25b3e14cade6acc1b49f3abd9426569c2caa2bf0180'
AND (
token = 'PKOoXyfMVX8XViYMAdrvEnmGDk+/ABoJBSnF2/MZhms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)