UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RwA7xpScqj+IdcTmKfD3G7G9Po5Hm2Hoj3EwWU42Px0='
WHERE
key_id = '337fc697c7d288db18e0252e469d70ec05ee62470bfdc34ac06f0acff14c0ba4'
AND (
token = 'RwA7xpScqj+IdcTmKfD3G7G9Po5Hm2Hoj3EwWU42Px0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)