UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KoIl5dTXIeDYseXyNHyffAg8WTB5RlfsuuaeyP8zT1I='
WHERE
key_id = '003be0f2f4be9d768b78a0d450dfbfbbc12b5cdf9cf7976170679591678e50a7'
AND (
token = 'KoIl5dTXIeDYseXyNHyffAg8WTB5RlfsuuaeyP8zT1I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)