UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qq+8dYfX9NYKILniVnsPKZ0vEhjTwFq9vkT81ejZPx8='
WHERE
key_id = 'e939982a211dc5fba9be4ff71e7ccddc2dfb0705309f2173812e7f92dad2bcd1'
AND (
token = 'Qq+8dYfX9NYKILniVnsPKZ0vEhjTwFq9vkT81ejZPx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)