UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZGIlo3ilaqoKXCiRjv2lBznxdmAta/Kw6QqxNHzT7fI='
WHERE
key_id = '1e12ab39fdbf4172d31c9d4814dddc92c3994b916f5d6371ce896c7813fbe478'
AND (
token = 'ZGIlo3ilaqoKXCiRjv2lBznxdmAta/Kw6QqxNHzT7fI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)