UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KQooRwv08xjWRr26ybUwLQI1sspYS+5ggM/cPUnLS30='
WHERE
key_id = '27712366ca4d71f0a996fb3643b95aaf2acd3027734c8e5123d9874de3d62845'
AND (
token = 'KQooRwv08xjWRr26ybUwLQI1sspYS+5ggM/cPUnLS30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)