UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MAbxZa84Tc3pldV5eXH71iLe68kt9HdrGhtLuBktWj4='
WHERE
key_id = 'e04f8c5079035a65012663cc1d9d5c1771f4761c4ff573335848e9250fbd9309'
AND (
token = 'MAbxZa84Tc3pldV5eXH71iLe68kt9HdrGhtLuBktWj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)