UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgDzkvPqsYa16qAE4u6muQ4qb+bzkVpk0cRVCthg2jo='
WHERE
key_id = '8f5f6504a4c7f17f76119dd4335ed78985b17fdb952b0d4d966469b0a7a94132'
AND (
token = 'SgDzkvPqsYa16qAE4u6muQ4qb+bzkVpk0cRVCthg2jo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)