UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a3dHp0SgVTIAs0LnVyAlx/Q/Kcbq9+j5VT1keSWMigQ='
WHERE
key_id = 'c49799a91177903b440c5a53a95f13be3284b89997f8e28de6fb3f7b35aa7039'
AND (
token = 'a3dHp0SgVTIAs0LnVyAlx/Q/Kcbq9+j5VT1keSWMigQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)