UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+rYU4sbWcMheHPWx3fPet2jcAxMMGbCb4E/2nBGs3iE='
WHERE
key_id = 'f8f7e4ff873f42041aeeab313a5e9981a3159e6c49d35c31a5b4b613eb2ddef1'
AND (
token = '+rYU4sbWcMheHPWx3fPet2jcAxMMGbCb4E/2nBGs3iE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)